<h2>Ultimos posts</h2>

<?php if(isset($this->posts) && count($this->posts)) :?>

<table>

<?php for ($i = 0; $i < count($this->posts);$i++):?>

<tr> 
	<td><?php echo $this->posts[$i]['Id']?></td>
 	<td><?php echo $this->posts[$i]['titulo']?></td>
 	<td><?php echo $this->posts[$i]['descripcion']?></td>
 	<?php if(Session::accesoView('admin')):?><td><a href="<?php echo BASE_URL. 'posts/editar/'.$this->posts[$i]['Id']; ?>"> Editar</a></td>
    <?php endif;?>
    <td><a href="<?php echo BASE_URL. 'posts/eliminar/'.$this->posts[$i]['Id']; ?>"> Eliminar</a></td>
</tr>

<?php endfor; ?>


</table>

<?php else :?>

<p><strong>No hay posts</strong></p>

<?php endif;?>

<p><input type="button" value="Nuevo" onClick="location.href='<?php BASE_URL; ?>posts/nuevo'"></p>
<?php if(Session::accesoView('admin')):?>
<p><a href="<?php BASE_URL; ?>posts/nuevo"> <strong>Nuevo posts</strong> </a></p>
<?php endif;?>
